<?php
namespace app\admin\controller;
use app\admin\model\Admin;
use think\Controller;
class Login extends Controller
{

	public function index()
	{
		return $this->fetch();
	}

	public function check()
	{
		$data = input('post.');
		$admin = Admin::get(['nickname'=>$data['username'],'password'=>md5($data['password'])]);
		if($admin){
			session('admin_id',$admin->admin_id);
			session('adminNickname',$admin->nickname);
			$this->success("登录成功");
		}else{
			$this->error('用户或者密码不正确');
		}
	}

}